{include file='common/doc'}
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="display: none;">
            <form  class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">昵称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="nickname" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">手机号</label>
                        <div class="layui-input-inline">
                            <input type="text"  name="phone" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">访问日期</label>
                        <div class="layui-input-inline">
                            <input type="text" name="last_time" class="layui-input" id="last_time">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <select name="status">
                                <option value=""></option>
                                <option value="1">启用</option>
                                <option value="0">警用</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="search">搜索</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-card-body">
            <table id="table_list" lay-filter="table_list"></table>
        </div>
    </div>
</div>
<template id="form">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</template>
<template id="table_toolbar">
    <div class="layui-btn-group">
        <?php echo $operation['toolbar']; ?>
    </div>
</template>
<!-- 表格操作列 -->
<script type="text/html" id="op_table">
    <?php echo $operation['tool']?>
</script>

<script src="/layuiadmin/layui/layui.js"></script>
</body>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index' ,'table','laydate'] ,function () {
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#last_time' //指定元素
            ,range: true
        });
        table.render({
            elem: '#table_list'
            ,height: 'full-50'
            ,toolbar: '#table_toolbar'
            ,url: 'read' //数据接口
            ,page: true //开启分页
            ,limit:20
            ,cols: [
                [ //表头
                    {type: 'checkbox' ,fixed: 'left'}
                    ,{type: 'numbers' ,fixed: 'left'}

                    ,{field: 'nickname' ,align: "center" ,title: '会员昵称'}
                    ,{field: 'phone' ,align: "center" ,title: '会员账户'}
                    ,{field: 'add_time' ,align: "center" ,title: '申请时间'}
                    ,{field: 'examine_time' ,align: "center" ,title: '审核时间'}
                    ,{field: 'admin_nickname' ,align: "center" ,title: '处理管理员'}
                    ,{field: 'name' ,align: "center" ,title: '用户真实姓名'}
                    ,{field: 'account' ,align: "center" ,title: '提现账户'}
                    ,{field: 'account_type' ,align: "center" ,title: '账户类型',templet:function(d){
                        let x= ['支付宝','微信'];
                        return x[d.account_type];
                    }}
                    ,{field: 'cash_sate' ,align: "center" ,title: '状态',templet:function(d){
                        let x= ['待处理','审核通过','成功','失败'];
                        return x[d.cash_sate];
                    }}

                    ,{field: 'cash_money' ,align: "center" ,title: '提现金额'}
                    ,{field: 'remark' ,align: "center" ,title: '备注'}
                    ,{field: 'cash_sate' ,width:100,align: "center" ,title: '状态',event:'examine',templet:function(d){
                        console.log( d.cash_state);
                        return d.cash_state ?  '' :'<button type="button" class="layui-btn layui-btn-sm  layui-btn-normal ">审核 </button>';
                    }}
                ]
            ]
        });
        table.on('tool(table_list)',function(obj){
            let event = obj.event;
            if (event.includes('examine')){

                layer.confirm('是否同意提现？', {
                    title:'提现审核',
                    btn: ['同意','拒绝'] //按钮
                }, function(index){
                    obj.data['cash_state']  = 1;
                    obj.data['status']  = 1;
                   let status =request({'url':'examine','data':obj.data});
                   if(status){
                       table.reload('table_list');
                   }
                   layer.close(index);
                }, function(){
                    layer.prompt({title: '备注', formType: 2}, function(text, index){
                        obj.data['cash_state']  = 3;
                        obj.data['remark'] = text;
                        let status =request({'url':'examine','data':obj.data});
                        if(status){
                            table.reload('table_list');
                        }
                        layer.close(index);
                    });
                });

            }
            console.log(event);
        });
    });
</script>
</html>

